package com.yuanfeng.activity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanfeng.activity.dto.GetAvailableVcBaseDTO;
import com.yuanfeng.activity.dto.JoinVoucherActivityDTO;
import com.yuanfeng.activity.dto.VoucherGoodsListDTO;
import com.yuanfeng.activity.dto.VoucherTemplateUpdateDTO;
import com.yuanfeng.activity.entity.ActivityVoucherTemplateEntity;
import com.yuanfeng.activity.vo.PlatformVoucherQueryVO;
import com.yuanfeng.activity.vo.VoucherGoodsQueryVO;
import com.yuanfeng.activity.vo.YfVoucherTemplateVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Entity com.yuanfeng.activity.entity.ActivityVoucherTemplate
 */
@Mapper
public interface ActivityVoucherTemplateMapper extends BaseMapper<ActivityVoucherTemplateEntity> {


    /**
     * 商家后台：查询优惠券信息
     *
     */
    IPage<YfVoucherTemplateVO> selectVoucherTemp(IPage<YfVoucherTemplateVO> page , @Param("param") Map<String, Object> paraMap);

    /**
     * 商家后台：查询优惠券信息总数
     *
     */
    Integer selectVoucherTempCount(Map<String, Object> paraMap);

    /**
     * 商家后台：删除代金券信息 1.1将删除代金券改为修改代金券状态
     * @param paraMap
     * @return
     */
    Integer deleteVoucherTemp(Map<String, String> paraMap);

    /**
     * 商家后台：插入代金券模板
     * @param param
     * @return
     */
    Integer insertVoucherTemplate(@Param("param") VoucherTemplateUpdateDTO param);

    /**
     * 查询可报名的优惠券活动
     * @return
     */
    List<PlatformVoucherQueryVO> selectPlatformVoucherList(@Param("shopId") Integer shopId);

    /**
     * 查询代金券商品数量
     * @param param
     * @return
     */
    Integer selectVoucherGoodsCount(@Param("param") JoinVoucherActivityDTO param);

    /**
     * 查询代金券店铺数量
     * @param param
     * @return
     */
    Integer selectVoucherShopCount(@Param("param") JoinVoucherActivityDTO param);

    /**
     * 新增代金券店铺
     * @param param
     */
    void insertVoucherShop(@Param("param") JoinVoucherActivityDTO param);

    /**
     * 修改代金券店铺
     * @param param
     */
    void updateVoucherShop(@Param("param") JoinVoucherActivityDTO param);

    /**
     * 修改代金券活动
     * @param goodsList
     */
    void updateVoucherActivity(@Param("param") List<VoucherGoodsListDTO> goodsList);

    /**
     * 批量修改代金券
     * @param goodsList
     */
    void updateVoucherTIdsBatch(@Param("param") List<VoucherGoodsListDTO> goodsList);

    /**
     * 分页查询代金券商品信息
     * @param page
     * @param param
     * @return
     */
    IPage<VoucherGoodsQueryVO> selectVoucherGoods(Page<VoucherGoodsQueryVO> page,@Param("param") JoinVoucherActivityDTO param);

    /**
     * 查询优惠券信息
     * @param param
     * @return
     */
    List<YfVoucherTemplateVO> selectFullReduceVcList(@Param("param")GetAvailableVcBaseDTO param);


    /**
     * 分页查询销售促销优惠券列表
     *
     * @param page
     * @param paraMap
     * @return
     */
    IPage<ActivityVoucherTemplateEntity> salesPromotionVoucherList(Page<ActivityVoucherTemplateEntity> page, @Param("param") Map<String, Object> paraMap);

    List<Integer> selectGoodsIdByVoucherCommon(@Param("voucherTId") Integer voucherTId);
}




